package reflect;

import java.lang.reflect.Constructor;

public class ReflectDemo3 {
    public static void main(String[] args) throws Exception {
        Person person = new Person("lisi",25);
        System.out.println(person);

        Class c=Class.forName("reflect.Person");
        Constructor constructor=c.getConstructor(String.class,int.class);
        Object o = constructor.newInstance("wang",32);
        System.out.println(o);

        Constructor constructor1=c.getConstructor(String.class);
        Object o1=constructor1.newInstance("wowowoo");
        System.out.println(o1);
    }
}
